package com.hzhr.iot.device.convertor;

import com.hzhr.iot.device.convertor.custom.*;
import com.hzhr.iot.core.util.HzhrTypeUtil;
import com.hzhr.iot.core.util.HzhrJsonUtil;
import java.util.Map;
import com.hzhr.iot.device.entity.DeviceMaintenanceCardItemEntity;
import com.hzhr.iot.device.entity.ext.DeviceMaintenanceCardItemEntityExt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.hzhr.iot.device.model.regulatorDevice_maintenanceCard_item.RegulatorDevice_MaintenanceCard_ItemModel;
import com.hzhr.iot.device.model.regulatorDevice_maintenanceCard_item.RegulatorDevice_MaintenanceCard_ItemGetModel;
import com.hzhr.iot.device.model.regulatorDevice_maintenanceCard_item.RegulatorDevice_MaintenanceCard_ItemPostModel;
import com.hzhr.iot.device.model.regulatorDevice_maintenanceCard_item.RegulatorDevice_MaintenanceCard_ItemPutModel;
import com.hzhr.iot.device.queryModel.custom.DeviceMaintenanceCardItemCustomQueryModel;

@Component
public class DeviceMaintenanceCardItemConvertor {
    @Autowired
    AlarmDataCustomConvertor alarmDataCustomConvertor;
    @Autowired
    CollectDataCustomConvertor collectDataCustomConvertor;
    @Autowired
    CollectDeviceCustomConvertor collectDeviceCustomConvertor;
    @Autowired
    CollectDeviceTypeCustomConvertor collectDeviceTypeCustomConvertor;
    @Autowired
    DeviceInfoCardCustomConvertor deviceInfoCardCustomConvertor;
    @Autowired
    DeviceMaintenanceCardCustomConvertor deviceMaintenanceCardCustomConvertor;
    @Autowired
    ImplFactoryCustomConvertor implFactoryCustomConvertor;
    @Autowired
    ImplIotDeviceTypeCustomConvertor implIotDeviceTypeCustomConvertor;
    @Autowired
    ImplRecordCustomConvertor implRecordCustomConvertor;
    @Autowired
    IotDeviceCustomConvertor iotDeviceCustomConvertor;
    @Autowired
    IotDeviceTypeCustomConvertor iotDeviceTypeCustomConvertor;
    @Autowired
    OptionsCustomConvertor optionsCustomConvertor;
    @Autowired
    ProdFactoryCustomConvertor prodFactoryCustomConvertor;
    @Autowired
    RegulatorCollectDataCustomConvertor regulatorCollectDataCustomConvertor;
    @Autowired
    UserCompanyCustomConvertor userCompanyCustomConvertor;

    public DeviceMaintenanceCardItemEntity regulatorDevice_MaintenanceCard_ItemModel2entity(RegulatorDevice_MaintenanceCard_ItemModel in) {
        //未转换字段: createUserId createTime updateUserId isValid updateTime state 
        if (in == null) return null;
        DeviceMaintenanceCardItemEntity result = new DeviceMaintenanceCardItemEntity();

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setCardId(HzhrTypeUtil.integer2integer(in.getCardId()));
        result.setRuningPressure(HzhrTypeUtil.double2double(in.getRuningPressure()));
        result.setMainClosePressure(HzhrTypeUtil.double2double(in.getMainClosePressure()));
        result.setSecondClosePressure(HzhrTypeUtil.double2double(in.getSecondClosePressure()));
        result.setOffPressure(HzhrTypeUtil.double2double(in.getOffPressure()));
        result.setEscapePressure(HzhrTypeUtil.double2double(in.getEscapePressure()));
        result.setMaintenanceItem(HzhrTypeUtil.string2string(in.getMaintenanceItem()));
        result.setMaintenanceTime(HzhrTypeUtil.long2date(in.getMaintenanceTime()));
        return result;
    }
    public DeviceMaintenanceCardItemEntity regulatorDevice_MaintenanceCard_ItemModel2entity(RegulatorDevice_MaintenanceCard_ItemModel in, DeviceMaintenanceCardItemEntity ori) {
        //未转换字段: createUserId createTime updateUserId isValid updateTime state 
        if (in == null) return null;
        DeviceMaintenanceCardItemEntity result = ori;

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setCardId(HzhrTypeUtil.integer2integer(in.getCardId()));
        result.setRuningPressure(HzhrTypeUtil.double2double(in.getRuningPressure()));
        result.setMainClosePressure(HzhrTypeUtil.double2double(in.getMainClosePressure()));
        result.setSecondClosePressure(HzhrTypeUtil.double2double(in.getSecondClosePressure()));
        result.setOffPressure(HzhrTypeUtil.double2double(in.getOffPressure()));
        result.setEscapePressure(HzhrTypeUtil.double2double(in.getEscapePressure()));
        result.setMaintenanceItem(HzhrTypeUtil.string2string(in.getMaintenanceItem()));
        result.setMaintenanceTime(HzhrTypeUtil.long2date(in.getMaintenanceTime()));
        return result;
    }
    public List<DeviceMaintenanceCardItemEntity> regulatorDevice_MaintenanceCard_ItemModelList2entityList(List<RegulatorDevice_MaintenanceCard_ItemModel> in) {
        if (in == null) return null;
        List<DeviceMaintenanceCardItemEntity> result = new ArrayList<>();
        for (RegulatorDevice_MaintenanceCard_ItemModel item : in) {
            result.add(regulatorDevice_MaintenanceCard_ItemModel2entity(item));
        }
        return result;
    }
    public RegulatorDevice_MaintenanceCard_ItemModel entity2regulatorDevice_MaintenanceCard_ItemModel(DeviceMaintenanceCardItemEntity in) {
        //未转换字段: maintenanceItemDes 
        if (in == null) return null;
        RegulatorDevice_MaintenanceCard_ItemModel result = new RegulatorDevice_MaintenanceCard_ItemModel();

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setCardId(HzhrTypeUtil.integer2integer(in.getCardId()));
        result.setRuningPressure(HzhrTypeUtil.double2double(in.getRuningPressure()));
        result.setMainClosePressure(HzhrTypeUtil.double2double(in.getMainClosePressure()));
        result.setSecondClosePressure(HzhrTypeUtil.double2double(in.getSecondClosePressure()));
        result.setOffPressure(HzhrTypeUtil.double2double(in.getOffPressure()));
        result.setEscapePressure(HzhrTypeUtil.double2double(in.getEscapePressure()));
        result.setMaintenanceItem(HzhrTypeUtil.string2string(in.getMaintenanceItem()));
        result.setMaintenanceTime(HzhrTypeUtil.date2long(in.getMaintenanceTime()));
        return result;
    }
    public List<RegulatorDevice_MaintenanceCard_ItemModel> entityList2regulatorDevice_MaintenanceCard_ItemModelList(List<DeviceMaintenanceCardItemEntity> in) {
        if (in == null) return null;
        List<RegulatorDevice_MaintenanceCard_ItemModel> result = new ArrayList<>();
        for (DeviceMaintenanceCardItemEntity item : in) {
            result.add(entity2regulatorDevice_MaintenanceCard_ItemModel(item));
        }
        return result;
    }
    public RegulatorDevice_MaintenanceCard_ItemModel ext2regulatorDevice_MaintenanceCard_ItemModel(DeviceMaintenanceCardItemEntityExt in) {
        //未转换字段: maintenanceItemDes 
        if (in == null) return null;
        RegulatorDevice_MaintenanceCard_ItemModel result = new RegulatorDevice_MaintenanceCard_ItemModel();

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setCardId(HzhrTypeUtil.integer2integer(in.getCardId()));
        result.setRuningPressure(HzhrTypeUtil.double2double(in.getRuningPressure()));
        result.setMainClosePressure(HzhrTypeUtil.double2double(in.getMainClosePressure()));
        result.setSecondClosePressure(HzhrTypeUtil.double2double(in.getSecondClosePressure()));
        result.setOffPressure(HzhrTypeUtil.double2double(in.getOffPressure()));
        result.setEscapePressure(HzhrTypeUtil.double2double(in.getEscapePressure()));
        result.setMaintenanceItem(HzhrTypeUtil.string2string(in.getMaintenanceItem()));
        result.setMaintenanceTime(HzhrTypeUtil.date2long(in.getMaintenanceTime()));
        return result;
    }
    public List<RegulatorDevice_MaintenanceCard_ItemModel> extList2regulatorDevice_MaintenanceCard_ItemModelList(List<DeviceMaintenanceCardItemEntityExt> in) {
        if (in == null) return null;
        List<RegulatorDevice_MaintenanceCard_ItemModel> result = new ArrayList<>();
        for (DeviceMaintenanceCardItemEntityExt item : in) {
            result.add(ext2regulatorDevice_MaintenanceCard_ItemModel(item));
        }
        return result;
    }
    public RegulatorDevice_MaintenanceCard_ItemGetModel extList2regulatorDevice_MaintenanceCard_ItemGetModel(List<DeviceMaintenanceCardItemEntityExt> extList, Integer total, Integer changeCount, Map<String, Object> query) {
        List<RegulatorDevice_MaintenanceCard_ItemModel> modelList = extList2regulatorDevice_MaintenanceCard_ItemModelList(extList);
        if (modelList == null) {
            RegulatorDevice_MaintenanceCard_ItemGetModel result = new RegulatorDevice_MaintenanceCard_ItemGetModel();
            result.setTotal(total);
            result.setChangeCount(changeCount);
            return result;
        }

         String _show = HzhrTypeUtil.object2string(query.get("_show"));
         Boolean _show_info = query.get("_show_info") != null ? Boolean.parseBoolean(query.get("_show_info").toString()) : false;

        if (!_show_info) {
            for (RegulatorDevice_MaintenanceCard_ItemModel model : modelList) {
                model.setCardId(null);
                model.setRuningPressure(null);
                model.setMainClosePressure(null);
                model.setSecondClosePressure(null);
                model.setOffPressure(null);
                model.setEscapePressure(null);
                model.setMaintenanceItem(null);
                model.setMaintenanceItemDes(null);
                model.setMaintenanceTime(null);
            }
        }

        RegulatorDevice_MaintenanceCard_ItemGetModel result = new RegulatorDevice_MaintenanceCard_ItemGetModel();
        if ("one".equals(_show)) {
            if (modelList.size() > 0) {
                result.setModel(modelList.get(0));
            }
         }
        if ("list".equals(_show)) {
            result.setModelList(modelList);
        }
        result.setTotal(total);
        result.setChangeCount(changeCount);
        return result;
    }
    public RegulatorDevice_MaintenanceCard_ItemGetModel entity2regulatorDevice_MaintenanceCard_ItemGetModel(DeviceMaintenanceCardItemEntity entity, Integer total, Integer changeCount, Map<String, Object> query) {
        List<DeviceMaintenanceCardItemEntityExt> extList = new ArrayList<>();
        if (entity == null) return extList2regulatorDevice_MaintenanceCard_ItemGetModel(extList, total, changeCount, query);
        extList.add(HzhrJsonUtil.convertObjectType(entity, DeviceMaintenanceCardItemEntityExt.class));
        return extList2regulatorDevice_MaintenanceCard_ItemGetModel(extList, total, changeCount, query);
     }
    public DeviceMaintenanceCardItemEntity regulatorDevice_MaintenanceCard_ItemPostModel2entity(RegulatorDevice_MaintenanceCard_ItemPostModel in) {
        //未转换字段: createUserId updateUserId escapePressure isValid updateTime mainClosePressure offPressure createTime cardId secondClosePressure id runingPressure state 
        if (in == null) return null;
        DeviceMaintenanceCardItemEntity result = new DeviceMaintenanceCardItemEntity();

        result.setMaintenanceItem(HzhrTypeUtil.string2string(in.getMaintenanceItem()));
        result.setMaintenanceTime(HzhrTypeUtil.string2date(in.getMaintenanceTime()));
        return result;
    }
    public DeviceMaintenanceCardItemEntity regulatorDevice_MaintenanceCard_ItemPostModel2entity(RegulatorDevice_MaintenanceCard_ItemPostModel in, DeviceMaintenanceCardItemEntity ori) {
        //未转换字段: createUserId updateUserId escapePressure isValid updateTime mainClosePressure offPressure createTime cardId secondClosePressure id runingPressure state 
        if (in == null) return null;
        DeviceMaintenanceCardItemEntity result = ori;

        result.setMaintenanceItem(HzhrTypeUtil.string2string(in.getMaintenanceItem()));
        result.setMaintenanceTime(HzhrTypeUtil.string2date(in.getMaintenanceTime()));
        return result;
    }
    public List<DeviceMaintenanceCardItemEntity> regulatorDevice_MaintenanceCard_ItemPostModelList2entityList(List<RegulatorDevice_MaintenanceCard_ItemPostModel> in) {
        if (in == null) return null;
        List<DeviceMaintenanceCardItemEntity> result = new ArrayList<>();
        for (RegulatorDevice_MaintenanceCard_ItemPostModel item : in) {
            result.add(regulatorDevice_MaintenanceCard_ItemPostModel2entity(item));
        }
        return result;
    }
    public RegulatorDevice_MaintenanceCard_ItemPostModel entity2regulatorDevice_MaintenanceCard_ItemPostModel(DeviceMaintenanceCardItemEntity in) {
        //未转换字段: escapePressure secondClosePressure runingPressure mainClosePressure offPressure 
        if (in == null) return null;
        RegulatorDevice_MaintenanceCard_ItemPostModel result = new RegulatorDevice_MaintenanceCard_ItemPostModel();

        result.setMaintenanceItem(HzhrTypeUtil.string2string(in.getMaintenanceItem()));
        result.setMaintenanceTime(HzhrTypeUtil.date2string(in.getMaintenanceTime()));
        return result;
    }
    public List<RegulatorDevice_MaintenanceCard_ItemPostModel> entityList2regulatorDevice_MaintenanceCard_ItemPostModelList(List<DeviceMaintenanceCardItemEntity> in) {
        if (in == null) return null;
        List<RegulatorDevice_MaintenanceCard_ItemPostModel> result = new ArrayList<>();
        for (DeviceMaintenanceCardItemEntity item : in) {
            result.add(entity2regulatorDevice_MaintenanceCard_ItemPostModel(item));
        }
        return result;
    }
    public RegulatorDevice_MaintenanceCard_ItemPostModel ext2regulatorDevice_MaintenanceCard_ItemPostModel(DeviceMaintenanceCardItemEntityExt in) {
        //未转换字段: escapePressure secondClosePressure runingPressure mainClosePressure offPressure 
        if (in == null) return null;
        RegulatorDevice_MaintenanceCard_ItemPostModel result = new RegulatorDevice_MaintenanceCard_ItemPostModel();

        result.setMaintenanceItem(HzhrTypeUtil.string2string(in.getMaintenanceItem()));
        result.setMaintenanceTime(HzhrTypeUtil.date2string(in.getMaintenanceTime()));
        return result;
    }
    public List<RegulatorDevice_MaintenanceCard_ItemPostModel> extList2regulatorDevice_MaintenanceCard_ItemPostModelList(List<DeviceMaintenanceCardItemEntityExt> in) {
        if (in == null) return null;
        List<RegulatorDevice_MaintenanceCard_ItemPostModel> result = new ArrayList<>();
        for (DeviceMaintenanceCardItemEntityExt item : in) {
            result.add(ext2regulatorDevice_MaintenanceCard_ItemPostModel(item));
        }
        return result;
    }
    public DeviceMaintenanceCardItemEntity regulatorDevice_MaintenanceCard_ItemPutModel2entity(RegulatorDevice_MaintenanceCard_ItemPutModel in) {
        //未转换字段: createUserId updateUserId escapePressure isValid updateTime mainClosePressure offPressure createTime cardId secondClosePressure id runingPressure state 
        if (in == null) return null;
        DeviceMaintenanceCardItemEntity result = new DeviceMaintenanceCardItemEntity();

        result.setMaintenanceItem(HzhrTypeUtil.string2string(in.getMaintenanceItem()));
        result.setMaintenanceTime(HzhrTypeUtil.string2date(in.getMaintenanceTime()));
        return result;
    }
    public DeviceMaintenanceCardItemEntity regulatorDevice_MaintenanceCard_ItemPutModel2entity(RegulatorDevice_MaintenanceCard_ItemPutModel in, DeviceMaintenanceCardItemEntity ori) {
        //未转换字段: createUserId updateUserId escapePressure isValid updateTime mainClosePressure offPressure createTime cardId secondClosePressure id runingPressure state 
        if (in == null) return null;
        DeviceMaintenanceCardItemEntity result = ori;

        result.setMaintenanceItem(HzhrTypeUtil.string2string(in.getMaintenanceItem()));
        result.setMaintenanceTime(HzhrTypeUtil.string2date(in.getMaintenanceTime()));
        return result;
    }
    public List<DeviceMaintenanceCardItemEntity> regulatorDevice_MaintenanceCard_ItemPutModelList2entityList(List<RegulatorDevice_MaintenanceCard_ItemPutModel> in) {
        if (in == null) return null;
        List<DeviceMaintenanceCardItemEntity> result = new ArrayList<>();
        for (RegulatorDevice_MaintenanceCard_ItemPutModel item : in) {
            result.add(regulatorDevice_MaintenanceCard_ItemPutModel2entity(item));
        }
        return result;
    }
    public RegulatorDevice_MaintenanceCard_ItemPutModel entity2regulatorDevice_MaintenanceCard_ItemPutModel(DeviceMaintenanceCardItemEntity in) {
        //未转换字段: escapePressure secondClosePressure runingPressure mainClosePressure offPressure 
        if (in == null) return null;
        RegulatorDevice_MaintenanceCard_ItemPutModel result = new RegulatorDevice_MaintenanceCard_ItemPutModel();

        result.setMaintenanceItem(HzhrTypeUtil.string2string(in.getMaintenanceItem()));
        result.setMaintenanceTime(HzhrTypeUtil.date2string(in.getMaintenanceTime()));
        return result;
    }
    public List<RegulatorDevice_MaintenanceCard_ItemPutModel> entityList2regulatorDevice_MaintenanceCard_ItemPutModelList(List<DeviceMaintenanceCardItemEntity> in) {
        if (in == null) return null;
        List<RegulatorDevice_MaintenanceCard_ItemPutModel> result = new ArrayList<>();
        for (DeviceMaintenanceCardItemEntity item : in) {
            result.add(entity2regulatorDevice_MaintenanceCard_ItemPutModel(item));
        }
        return result;
    }
    public RegulatorDevice_MaintenanceCard_ItemPutModel ext2regulatorDevice_MaintenanceCard_ItemPutModel(DeviceMaintenanceCardItemEntityExt in) {
        //未转换字段: escapePressure secondClosePressure runingPressure mainClosePressure offPressure 
        if (in == null) return null;
        RegulatorDevice_MaintenanceCard_ItemPutModel result = new RegulatorDevice_MaintenanceCard_ItemPutModel();

        result.setMaintenanceItem(HzhrTypeUtil.string2string(in.getMaintenanceItem()));
        result.setMaintenanceTime(HzhrTypeUtil.date2string(in.getMaintenanceTime()));
        return result;
    }
    public List<RegulatorDevice_MaintenanceCard_ItemPutModel> extList2regulatorDevice_MaintenanceCard_ItemPutModelList(List<DeviceMaintenanceCardItemEntityExt> in) {
        if (in == null) return null;
        List<RegulatorDevice_MaintenanceCard_ItemPutModel> result = new ArrayList<>();
        for (DeviceMaintenanceCardItemEntityExt item : in) {
            result.add(ext2regulatorDevice_MaintenanceCard_ItemPutModel(item));
        }
        return result;
    }
    public DeviceMaintenanceCardItemCustomQueryModel regulatorDevice_MaintenanceCard_ItemService_query2queryModel(Map<String, Object> query) {
        DeviceMaintenanceCardItemCustomQueryModel queryModel = new DeviceMaintenanceCardItemCustomQueryModel();

        Integer _equal_id = HzhrTypeUtil.object2integer(query.get("_equal_id"));
        if (_equal_id != null) {
            queryModel.setEqual_id(_equal_id);
         }

        Boolean _show_info = HzhrTypeUtil.object2boolean(query.get("_show_info"));
        if (_show_info != null && _show_info) {
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setExt_maintenanceItemExt(true);
            queryModel.setShow24(true);
            queryModel.setShow(true);
        }

        Integer page = HzhrTypeUtil.object2integer(query.get("_page"));
        Integer count = HzhrTypeUtil.object2integer(query.get("_count"));
        queryModel.setPage(page, count);

        return queryModel;
    }

}

